package zouran.shounewsspringboot.entity;

import lombok.Data;
import org.springframework.stereotype.Component;

/**
 * @author zouran
 * createDate：2023/5/31  20:11
 */
@Component
@Data
public class ResultMap <T>{
    private int code;
    private String message;
    private T data;
    public ResultMap<T> success(T data){
        this.code=1;
        this.message="success";
        this.data=data;
        return this;
    }
    public ResultMap<T> error(String message){
        this.code=0;
        this.message=message;
        this.data=null;
        return this;
    }
    public ResultMap<T> error(){
        this.code=0;
        this.message="error";
        this.data=null;
        return this;
    }
}
